﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace S.EliminationOrDath.Infrastructure
{
    /// <summary>
    /// 仓储--通用泛型接口
    /// </summary>
    public interface IBaseRepository<T>
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="t">实体名称</param>
        /// <returns></returns>
        Task<bool> Add(T t);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t">实体名称</param>
        /// <returns></returns>
        Task<bool> Update(T t);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id">要删除的字段Id</param>
        /// <returns></returns>
        Task<bool> Delete(int id);
        /// <summary>
        /// 显示所有数据
        /// </summary>
        /// <returns></returns>
        Task<IQueryable<T>> GetAll();
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<bool> AddRange(List<T> ts);
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<bool> DeleteRange(List<T> ts);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="ts"></param>
        /// <returns></returns>
        Task<bool> UpdateRange(List<T> ts);
    }
}
